using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class AnswerInfo
    {
		#region Local Variable
		public enum Field
		{
			ID,
			Question_ID,
			Description,
			Explanation,
			IsRight,
			Order_Answer,
			Text_Answer,
			Enabled,
			ANAL_A0,
			ANAL_A1,
			ANAL_A2,
			ANAL_A3,
			ANAL_A4,
			ANAL_A5,
			ANAL_A6,
			ANAL_A7,
			ANAL_A8,
			ANAL_A9
		}
		private Int64 _ID;
		private Int64 _Question_ID;
		private String _Description;
		private String _Explanation;
		private Boolean _IsRight;
		private String _Order_Answer;
		private String _Text_Answer;
		private Boolean _Enabled;
		private String _ANAL_A0;
		private String _ANAL_A1;
		private String _ANAL_A2;
		private String _ANAL_A3;
		private String _ANAL_A4;
		private String _ANAL_A5;
		private String _ANAL_A6;
		private String _ANAL_A7;
		private String _ANAL_A8;
		private String _ANAL_A9;
		
		public Int64 ID{	get{ return _ID;} set{_ID = value;} }
		public Int64 Question_ID{	get{ return _Question_ID;} set{_Question_ID = value;} }
		public String Description{	get{ return _Description;} set{_Description = value;} }
		public String Explanation{	get{ return _Explanation;} set{_Explanation = value;} }
		public Boolean IsRight{	get{ return _IsRight;} set{_IsRight = value;} }
		public String Order_Answer{	get{ return _Order_Answer;} set{_Order_Answer = value;} }
		public String Text_Answer{	get{ return _Text_Answer;} set{_Text_Answer = value;} }
		public Boolean Enabled{	get{ return _Enabled;} set{_Enabled = value;} }
		public String ANAL_A0{	get{ return _ANAL_A0;} set{_ANAL_A0 = value;} }
		public String ANAL_A1{	get{ return _ANAL_A1;} set{_ANAL_A1 = value;} }
		public String ANAL_A2{	get{ return _ANAL_A2;} set{_ANAL_A2 = value;} }
		public String ANAL_A3{	get{ return _ANAL_A3;} set{_ANAL_A3 = value;} }
		public String ANAL_A4{	get{ return _ANAL_A4;} set{_ANAL_A4 = value;} }
		public String ANAL_A5{	get{ return _ANAL_A5;} set{_ANAL_A5 = value;} }
		public String ANAL_A6{	get{ return _ANAL_A6;} set{_ANAL_A6 = value;} }
		public String ANAL_A7{	get{ return _ANAL_A7;} set{_ANAL_A7 = value;} }
		public String ANAL_A8{	get{ return _ANAL_A8;} set{_ANAL_A8 = value;} }
		public String ANAL_A9{	get{ return _ANAL_A9;} set{_ANAL_A9 = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public AnswerInfo()
		{
			_ID = 0;
			_Question_ID = 0;
			_Description = "";
			_Explanation = "";
			_IsRight = true;
			_Order_Answer = "";
			_Text_Answer = "";
			_Enabled = true;
			_ANAL_A0 = "";
			_ANAL_A1 = "";
			_ANAL_A2 = "";
			_ANAL_A3 = "";
			_ANAL_A4 = "";
			_ANAL_A5 = "";
			_ANAL_A6 = "";
			_ANAL_A7 = "";
			_ANAL_A8 = "";
			_ANAL_A9 = "";
		}
		public AnswerInfo(
		Int64 ID,
		Int64 Question_ID,
		String Description,
		String Explanation,
		Boolean IsRight,
		String Order_Answer,
		String Text_Answer,
		Boolean Enabled,
		String ANAL_A0,
		String ANAL_A1,
		String ANAL_A2,
		String ANAL_A3,
		String ANAL_A4,
		String ANAL_A5,
		String ANAL_A6,
		String ANAL_A7,
		String ANAL_A8,
		String ANAL_A9
		)
		{
			_ID = ID;
			_Question_ID = Question_ID;
			_Description = Description;
			_Explanation = Explanation;
			_IsRight = IsRight;
			_Order_Answer = Order_Answer;
			_Text_Answer = Text_Answer;
			_Enabled = Enabled;
			_ANAL_A0 = ANAL_A0;
			_ANAL_A1 = ANAL_A1;
			_ANAL_A2 = ANAL_A2;
			_ANAL_A3 = ANAL_A3;
			_ANAL_A4 = ANAL_A4;
			_ANAL_A5 = ANAL_A5;
			_ANAL_A6 = ANAL_A6;
			_ANAL_A7 = ANAL_A7;
			_ANAL_A8 = ANAL_A8;
			_ANAL_A9 = ANAL_A9;
		}
		public AnswerInfo(DataRow dr)
		{
			if (dr != null)
			{
				_ID = dr[Field.ID.ToString()] == DBNull.Value?0:Convert.ToInt64(dr[Field.ID.ToString()]);
				_Question_ID = dr[Field.Question_ID.ToString()] == DBNull.Value?0:Convert.ToInt64(dr[Field.Question_ID.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Explanation = dr[Field.Explanation.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Explanation.ToString()]);
				_IsRight = dr[Field.IsRight.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.IsRight.ToString()]);
				_Order_Answer = dr[Field.Order_Answer.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Order_Answer.ToString()]);
				_Text_Answer = dr[Field.Text_Answer.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Text_Answer.ToString()]);
				_Enabled = dr[Field.Enabled.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.Enabled.ToString()]);
				_ANAL_A0 = dr[Field.ANAL_A0.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A0.ToString()]);
				_ANAL_A1 = dr[Field.ANAL_A1.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A1.ToString()]);
				_ANAL_A2 = dr[Field.ANAL_A2.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A2.ToString()]);
				_ANAL_A3 = dr[Field.ANAL_A3.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A3.ToString()]);
				_ANAL_A4 = dr[Field.ANAL_A4.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A4.ToString()]);
				_ANAL_A5 = dr[Field.ANAL_A5.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A5.ToString()]);
				_ANAL_A6 = dr[Field.ANAL_A6.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A6.ToString()]);
				_ANAL_A7 = dr[Field.ANAL_A7.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A7.ToString()]);
				_ANAL_A8 = dr[Field.ANAL_A8.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A8.ToString()]);
				_ANAL_A9 = dr[Field.ANAL_A9.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.ANAL_A9.ToString()]);
			}
		}
		public AnswerInfo(AnswerInfo objEntr)
		{			
			_ID = objEntr.ID;			
			_Question_ID = objEntr.Question_ID;			
			_Description = objEntr.Description;			
			_Explanation = objEntr.Explanation;			
			_IsRight = objEntr.IsRight;			
			_Order_Answer = objEntr.Order_Answer;			
			_Text_Answer = objEntr.Text_Answer;			
			_Enabled = objEntr.Enabled;			
			_ANAL_A0 = objEntr.ANAL_A0;			
			_ANAL_A1 = objEntr.ANAL_A1;			
			_ANAL_A2 = objEntr.ANAL_A2;			
			_ANAL_A3 = objEntr.ANAL_A3;			
			_ANAL_A4 = objEntr.ANAL_A4;			
			_ANAL_A5 = objEntr.ANAL_A5;			
			_ANAL_A6 = objEntr.ANAL_A6;			
			_ANAL_A7 = objEntr.ANAL_A7;			
			_ANAL_A8 = objEntr.ANAL_A8;			
			_ANAL_A9 = objEntr.ANAL_A9;			
		}
        #endregion Constructor
        
        #region InitTable
		public DataTable ToDataTable()
		{
			DataTable dt = new DataTable("Answer");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.ID.ToString(), typeof(Int64)),
				new DataColumn(Field.Question_ID.ToString(), typeof(Int64)),
				new DataColumn(Field.Description.ToString(), typeof(String)),
				new DataColumn(Field.Explanation.ToString(), typeof(String)),
				new DataColumn(Field.IsRight.ToString(), typeof(Boolean)),
				new DataColumn(Field.Order_Answer.ToString(), typeof(String)),
				new DataColumn(Field.Text_Answer.ToString(), typeof(String)),
				new DataColumn(Field.Enabled.ToString(), typeof(Boolean)),
				new DataColumn(Field.ANAL_A0.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A1.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A2.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A3.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A4.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A5.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A6.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A7.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A8.ToString(), typeof(String)),
				new DataColumn(Field.ANAL_A9.ToString(), typeof(String))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.ID.ToString()] = _ID;
			row[Field.Question_ID.ToString()] = _Question_ID;
			row[Field.Description.ToString()] = _Description;
			row[Field.Explanation.ToString()] = _Explanation;
			row[Field.IsRight.ToString()] = _IsRight;
			row[Field.Order_Answer.ToString()] = _Order_Answer;
			row[Field.Text_Answer.ToString()] = _Text_Answer;
			row[Field.Enabled.ToString()] = _Enabled;
			row[Field.ANAL_A0.ToString()] = _ANAL_A0;
			row[Field.ANAL_A1.ToString()] = _ANAL_A1;
			row[Field.ANAL_A2.ToString()] = _ANAL_A2;
			row[Field.ANAL_A3.ToString()] = _ANAL_A3;
			row[Field.ANAL_A4.ToString()] = _ANAL_A4;
			row[Field.ANAL_A5.ToString()] = _ANAL_A5;
			row[Field.ANAL_A6.ToString()] = _ANAL_A6;
			row[Field.ANAL_A7.ToString()] = _ANAL_A7;
			row[Field.ANAL_A8.ToString()] = _ANAL_A8;
			row[Field.ANAL_A9.ToString()] = _ANAL_A9;
			return row;
		}
        #endregion InitTable
    }
}
